<div dojoType="dojo.data.ItemFileReadStore" jsId="markValues" data='<?=$this->binMarkValStore?>'>

<table>
<tr>
    <td>
    <table class="user-list" border="0" cellpadding="5" cellspacing="2">
        <tr>
            <th>
                <?=$this->translate('Students')?>
            </th>
        <?$i=0?>
        <?foreach ($this->markTypes as $index => $value) {?>
            <?if(($value['type_id'] == 1) || ($value['type_id'] == 2)) {?>
            <th>
                <?=$value['name']?>
                <input type="hidden" name="marks[<?=$i?>][name]" value="<?=$value['name']?>">
                <input type="hidden" name="marks[<?=$i?>][type_id]" value="<?=$value['type_id']?>">
                <input type="hidden" name="marks[<?=$i?>][mark_id]" value="<?=$value['id']?>">
            </th>
            <? } ?>
        <? $i++; } ?>
        </tr>
        <?foreach($this->students as $index => $studentValues) {?>
            <tr>
                <td>
                    <?=$studentValues['second_name']?> <?=$studentValues['first_name']?> <?=$studentValues['last_name']?>
                </td>
                <?$i = 0;?>
                <?foreach ($this->markTypes as $innerIndex => $innerValue) {?>
                         <? if(isset($this->markTypes[$i]['user_id'])) {
                                $insertValue = $this->markTypes[$i]['user_id'][$studentValues['id']];
                            } else {
                                $insertValue = '';
                            }
                            ?>
                        <?if($innerValue['type_id'] == '1') {?>

                            <td>
                                <input
                                name='marks[<?=$i?>]<?=isset($this->marksValues[$studentValues['id']][$innerValue['id']]['id']) ? '[update_id][' . $this->marksValues[$studentValues['id']][$innerValue['id']]['id'] . ']' : '[user_id]' . '[' . $studentValues['id'] . ']'?>'
                                required='true' dojoType="dijit.form.ValidationTextBox" style="width: 50px" regExp="\d{1,2}|100"
                                value="<?=isset($this->marksValues[$studentValues['id']][$innerValue['id']]) ? $this->marksValues[$studentValues['id']][$innerValue['id']]['value'] : $insertValue?>">
                            </td>
                            <? } else if($innerValue['type_id'] == '2') { ?>
                            <td>
                            <input
                                name='marks[<?=$i?>]<?=isset($this->marksValues[$studentValues['id']][$innerValue['id']]['id']) ? '[update_id][' . $this->marksValues[$studentValues['id']][$innerValue['id']]['id'] . ']' : '[user_id]' . '[' . $studentValues['id'] . ']'?>'
                                value="<?=isset($this->marksValues[$studentValues['id']][$innerValue['id']]) ? $this->marksValues[$studentValues['id']][$innerValue['id']]['value'] : $insertValue;?>"
                                searchAttr='name' dojoType="dijit.form.FilteringSelect" store="markValues">
                            </td>
                        <? } ?>
                <? $i++;} ?>
        <? } ?>
            </tr>
        </tr>
        </table>
        </td>
    </tr>
</table>